package com.hmall.trade.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.amqp.AmqpException;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessagePostProcessor;

// 他们可能的封装方式
@AllArgsConstructor(staticName = "of")
@Data
@NoArgsConstructor
public class DelayMessageProcessor2 implements MessagePostProcessor {
    private MultiDelayCheckMsg msg;
    @Override
    public Message postProcessMessage(Message message) throws AmqpException {
        message.getMessageProperties().setDelay(msg.pollNextDelayTime().intValue());
        return message;
    }
}
